#ifndef _KSHONEYCOMBBTN_H_
#define _KSHONEYCOMBBTN_H_
#include <QPushButton>
#include <QEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QLabel>
#include <QPainter>

#define BTNUPDATE if (m_oldbtnstate != m_btnstate)\
			{\
				repaint();\
				m_oldbtnstate = m_btnstate;\
			}\

class KSHoneyCombBtn : public QLabel
{
	Q_OBJECT

	enum BTNSTATE
	{
		BTNNORMAL,
		BTNHOVER,
		BTNPRESS,
		BTNDISABLE	
	};

public:
	explicit  KSHoneyCombBtn(QWidget *parent = 0);
	~KSHoneyCombBtn();


	void setPixmap(const QPixmap &pixmap);

	void setDisabled(bool b);

signals:
	void clicked();

protected:
	void paintEvent(QPaintEvent *e);

	void leaveEvent(QEvent *event);


	void mouseMoveEvent(QMouseEvent *e);

	void mousePressEvent(QMouseEvent *e);

	void mouseReleaseEvent(QMouseEvent *e)
	{
		m_btnstate = BTNNORMAL;
		BTNUPDATE;
		QLabel::mouseReleaseEvent(e);
	}
private:
	bool m_isActive;

	bool isInRect(QPoint p);

	QPixmap m_normalimg;
	QPixmap m_hoverimg;
	QPixmap m_pressedimg;
	QPixmap m_disableimg;

	BTNSTATE m_btnstate;
	BTNSTATE m_oldbtnstate;
};

#endif